import java.util.Scanner;
public class 水仙花 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int number = sc.nextInt();
        int ge = number%100;
        int shi = number/10%10;
        int bai = number/10/10%10;
        //判定条件是将三位数的每个数值取出来，计算出立方和后与原来数字相比较是否相等
        if(ge*ge*ge + shi*shi*shi +bai*bai*bai ==number){
            System.out.println(number );

        }
    }
}
